﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using MSBDATAModel;
public partial class Admin_CauHinhWS : System.Web.UI.Page
{
    MSBDATAEntities entities = new MSBDATAEntities();

    protected void Page_Load(object sender, EventArgs e)
    {
        if (IsPostBack==false)
        {
            int cauHinhID = 1;
            var matches = from c in entities.C_CAU_HINH
                          where c.Ma == cauHinhID
                          select c;
            C_CAU_HINH ch = matches.First();
            this.TextBoxTenWSKH.Text = ch.TenWSKH;
            this.TextBoxTenWSLM.Text = ch.TenWSLM;
            this.TextBoxLinkWSKH.Text = ch.LinkWSKH;
            this.TextBoxLinkWSLM.Text = ch.LinkWSLM;
        }

    }
    protected void ButtonUpdate_Click(object sender, EventArgs e)
    {
        int cauHinhID = 1;
        var matches = from c in entities.C_CAU_HINH
                      where c.Ma == cauHinhID
                      select c;
        C_CAU_HINH ch = matches.First();

        ch.TenWSKH = this.TextBoxTenWSKH.Text;
        ch.TenWSLM = this.TextBoxTenWSLM.Text;
        ch.LinkWSKH = this.TextBoxLinkWSKH.Text;
        ch.LinkWSLM = this.TextBoxLinkWSLM.Text;

        entities.SaveChanges();
    }
}